how to determine the midpoint